Off By One Error

 

One of the most common mistakes in computer programming is getting the boundaries of a loop wrong by one. To repeat something ten times, for instance, one counts down from 9 to 0, not 10 to 0.

So imagine my embarrassment when I discovered recently that my planned retirement from Federal Service will be after 30 years and 1 day — not 30 years, as I had planned! My blunder in filling out the forms was to put down the same day of the year, August 2nd, as I began working for the government in 1981. Oops! The taxpayers get me for one extra day ...

(cf. Wikipedia "Off-by-one error", and ProgrammingProverbs (2001-12-04), ...) - ^z - 2011-06-25